package lab02.test27;

import java.util.InputMismatchException;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        int a;
        //从键盘输入一个整数
        Scanner scanner=new Scanner(System.in);
        System.out.println("Please input an int:");
        try{
            a=scanner.nextInt();
            //错误类型：类型不匹配
        }catch (InputMismatchException e){
            System.out.println("类型不匹配！！");

        }finally {

        }

        a=scanner.nextInt();
        // 输入行可能会出错,放到try里面
        System.out.println("a="+a);
    }
}
